package com.metadata_system.api_server.system_server;


import com.metadata_system.api.annotations.CheckTokenUser;
import com.metadata_system.common.dto.ApiResult;
import com.metadata_system.common.http.request_dto.LoginUserRequest;
import com.metadata_system.common.service.CommonUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/system-server/v001/Home/")
public class HomeController {

    @Autowired(required = false)
    CommonUserService commonUserService;
    @Autowired(required = false)
    LoginUserRequest loginUserRequest;

    @RequestMapping(value = "getUnReadCount", method = {RequestMethod.POST, RequestMethod.GET})
    @CheckTokenUser
    public ApiResult getUnReadCount(
    ) {
        return commonUserService.getUnReadCount(loginUserRequest.getTokenUser().decodeID());
    }
}
